package com.voja.mrvica2;

import android.animation.ObjectAnimator;
import android.view.View;
import android.widget.FrameLayout;

public class Animator {
    
    public static final int ANIM_DURATION = 500;

    private FrameLayout view; 
    
    public Animator(FrameLayout v) {
        view = v;
    }
    
    public void setAlpha(float alpha) {
        view.setAlpha(alpha);
        if (alpha == 0) {
            view.setVisibility(View.GONE);
        } else {
            view.setVisibility(View.VISIBLE);
        }
    }
    
    public float getAlpha() {
        return view.getAlpha();
    }
    
    public void animate(float alpha) {
        ObjectAnimator.ofFloat(this, "alpha", alpha)
                      .setDuration(ANIM_DURATION)
                      .start();
    }
    
}
